package com.jt.controller;

import com.jt.pojo.ItemCat;
import com.jt.pojo.ItemCatParam;
import com.jt.service.ItemCatParamService;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/itemCatParam")
public class ItemCatParamController {
    @Autowired
    private ItemCatParamService itemCatParamService;
/**
 * 请求路径：findItemCatParamListByType
 * 参数：itemCatId   paramType
 * 返回值：SysResult
 */

    @GetMapping("/findItemCatParamListByType")
    public SysResult findItemCatParamListByType (ItemCatParam itemCatParam){
      List<ItemCatParam> catParamList =  itemCatParamService.findItemCatParamListByType(itemCatParam);
        return SysResult.success(catParamList);
    }
    @PostMapping("/addItemCatParam")
    public SysResult addItemCatParam (@RequestBody ItemCatParam itemCatParam){
        itemCatParamService.addItemCatParam(itemCatParam);
        return SysResult.success();
    }
    @PutMapping("/updateItemCatParam")
    public SysResult updateItemCatParam (@RequestBody ItemCatParam itemCatParam){
       itemCatParamService.updateItemCatParam (itemCatParam);
        return SysResult.success();
    }
    @DeleteMapping("/deleteItemCatParamById")
    public SysResult deleteItemCatParam(Integer paramId){
        itemCatParamService.deleteItemCatParam(paramId);
        return SysResult.success();
    }
}
